package gameplaying;

import java.util.Scanner;

//Nim博弈
public class NimGame {
	
	public static void main(String[] args) {
		NimGame object = new NimGame();
//		object.getRes();
		object.getResII();
	}
	
	public static final int MAX = 102;
	public int[] stones = new int[MAX];
	
	//HDU 1850 Runtime: 327MS
	public void getRes(){
		Scanner scanner = new Scanner(System.in);
		while(scanner.hasNext()){
			int m = scanner.nextInt();
			if(m == 0){
				break;
			}
			int sum = 0;
			for (int i = 0; i < m; i++) {
				stones[i] = scanner.nextInt();
				sum ^= stones[i];
			}
			//必败
			if(sum == 0){
				System.out.println(0);
			}else{
				//输出有多少方法能赢
				//只要sum ^ stones[i] ^ ai = 0,就可以到达必败态，而ai < stones[i]
				int ans = 0;
				for (int i = 0; i < m; i++) {
					int cur = sum ^ stones[i];
					if(cur < stones[i]){
						ans++;
					}
				}
				System.out.println(ans);
			}
		}
		scanner.close();
	}
	
	//HDU 1851,每一堆的数目为Mi，每次最多去Li
	//Runtime 296MS
	public void getResII(){
		Scanner scanner = new Scanner(System.in);
		int testCases = scanner.nextInt();
		for (int t = 1; t <= testCases; t++) {
			int n = scanner.nextInt();
			int sum = 0;
			for(int i = 0; i < n; i++){
				int total = scanner.nextInt();
				int per = scanner.nextInt();
				sum ^= total % (per + 1);
			}
			if(sum == 0){
				System.out.println("Yes");
			}else{
				System.out.println("No");
			}
		}
		scanner.close();
	}
}
